home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / g / gnu_c / crssrc16.zoo / src / box.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-27  |  1.5 KB  |  50 lines

  1. /*
  2.  * Copyright (c) 1981 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  */
  17.  
  18. #ifndef lint
  19. static char sccsid[] = "@(#)box.c    5.3 (Berkeley) 6/30/88";
  20. #endif /* not lint */
  21.  
  22. # include    "curses.ext"
  23.  
  24. /*
  25.  *    This routine draws a box around the given window with "vert"
  26.  * as the vertical delimiting char, and "hor", as the horizontal one.
  27.  *
  28.  */
  29. void box(win, vert, hor)
  30. reg WINDOW    *win;
  31. int        vert, hor; {
  32.  
  33.     reg int        i;
  34.     reg int        endy, endx;
  35.     reg char    *fp, *lp;
  36.  
  37.     endx = win->_maxx;
  38.     endy = win->_maxy - 1;
  39.     fp = win->_y[0];
  40.     lp = win->_y[endy];
  41.     for (i = 0; i < endx; i++)
  42.         fp[i] = lp[i] = hor;
  43.     endx--;
  44.     for (i = 0; i <= endy; i++)
  45.         win->_y[i][0] = (win->_y[i][endx] = vert);
  46.     if (!win->_scroll && (win->_flags&_SCROLLWIN))
  47.         fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
  48.     touchwin(win);
  49. }
  50.